
#include "SettingNameTestFile.h"

void SettingNameClass::fillingInVector(const vector_str vec, const string path_file, vector_str &vec_end) {
    FOR_SIZE_T(i, vec.size()) {
        vec_end.push_back(path_file+'/'+vec[i]);
    }
}

string SettingNameClass::getPathFile(string name_file, bool json_or_ini) {

    if (json_or_ini) {

        FOR_SIZE_T(i, nameFileJsonRes.size()) {
            if(comparingPathWithFile(nameFileJsonRes[i], name_file)) {
                return nameFileJsonRes[i];
            }
        }
        
    } else {

        FOR_SIZE_T(i, nameFilesIniLocle.size()) {
            if(comparingPathWithFile(nameFilesIniLocle[i], name_file)) {
                return nameFilesIniLocle[i];
            }
        }

    }

    return "ERROR";

}

SettingNameClass::SettingNameClass() {
    nameFileJSON = RWJF.readStr("TechSetting.Res");
    nameFileINI = RWJF.readStr("LangSetting.Lang");
    nameFileLocalesSetting = RWJF.readStr("LangSetting.Lang_setting");

    fillingInVector(NAME_FILE_RES, nameFileJSON, nameFileJsonRes);
    fillingInVector(NAME_FILE_LOCALE, nameFileINI, nameFilesIniLocle);

}

SettingNameClass::~SettingNameClass() {
    if (!RIF) {
        delete RIF;
    }
}
